﻿using System.Windows;

namespace CNGIDemo
{
    /// <summary>
    /// Interaction logic for SetFilterUtil.xaml
    /// </summary>
    public partial class SetFilterUtil : Window
    {
        public delegate void ApplyFilterRuleHandler(object sender, string timeInterval,string ipv4SourceAddress, string ipv6SourceAddress);
        public event ApplyFilterRuleHandler ApplyFilterRuleEvent;
        public SetFilterUtil()
        {
            InitializeComponent();
        }

        public SetFilterUtil(string _timeInterval)
        {
            InitializeComponent();
            this.TimeInterval.Text = _timeInterval;
        }

        private void Apply_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
            if (ApplyFilterRuleEvent != null)
            {
                ApplyFilterRuleEvent(this, this.TimeInterval.Text.ToString(), this.Ipv4SourceAddress.Text.ToString(), this.Ipv6SourceAddress.Text.ToString());
            }
        }

        private void Cancle_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
